<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>render components</title>
</head>

<body>
  <script src="../../node_modules/vue/dist/vue.js"></script>
  <div id="app">
    <button @click="ok=!ok">toggle</button>
    <example :ok="ok"/>
  </div>
  <script>
    const Foo = {
      render: h => h('div', 'foo')
    }
    const Bar = {
      render: h => h('div', 'bar')
    }
    Vue.component('example', {
      props: ['ok'],
      render(h) {
        return this.ok ? h(Foo) : h(Bar)
      }
    })
    new Vue({
      el: '#app',
      data() {
        return {
          ok: true
        }
      }
    })
  </script>
</body>

</html>